import {get} from '../../utils/request.js'
const state = {
products:[],
total:0
}

const actions = {
// 查询所有产品信息
findAllProduct(context,list){
    get('/product/pageQuery',list).then(res=>{
        // console.log(res.data.list);
        let response = res.data.list
        let total = res.data.total
        context.commit('SET_PRODUCT',response)
        context.commit('SET_TOTAL',total)
    })
}
}

const mutations = {
    SET_PRODUCT(state,response){
        state.products = response
    },
    SET_TOTAL(state,total){
        state.total = total
    },
}

export default {
    namespaced:true,
    state,
    actions,
    mutations
}